home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir37 / whtday11.zip / WHATDAY.DOC < prev   
Text File  |  1993-10-09  |  5KB  |  162 lines

  1.  
  2.  
  3.                                  WhatDay v.1.1
  4.                                Batch File Utility
  5.                         FREEWARE by Platypus Programming
  6.  
  7.         WhatDay generates an ERRORLEVEL code based on what day of the
  8.         week it is.  "Huh?", you say?  Put WhatDay in a batch file and
  9.         you can run certain things on certain days.  The program will
  10.         (very quickly) run and leave an ERRORLEVEL in it's wake (0 is
  11.         returned for Sunday, 6 for Saturday);
  12.  
  13.  
  14.         Here's what the DOS 6.0 help has to say about IF ERRORLEVEL:
  15.  
  16.                 Syntax:  IF ERRORLEVEL number command
  17.  
  18.                 ERRORLEVEL number specifies a true condition
  19.                 only if the previous program run by
  20.                 COMMAND.COM returned an exit code equal to or
  21.                 greater than number
  22.  
  23.         Ahhh...leave it to Microsoft <g>.  The important thing to glean
  24.         from that is that you need to process the errorlevel BACKWARDS.
  25.         The next dealoid is a batch file that should explain it all.
  26.  
  27. REM ****************
  28. REM START BATCH FILE
  29. REM ****************
  30. @echo off
  31. REM Note that WhatDay v.1.1 already outputs a message with the
  32. REM     day of the week, so this batch file is useful only as
  33. REM     an example.
  34. whatday
  35. if errorlevel 6 goto Saturday
  36. if errorlevel 5 goto Friday
  37. if errorlevel 4 goto Thursday
  38. if errorlevel 3 goto Wednesday
  39. if errorlevel 2 goto Tuesday
  40. if errorlevel 1 goto Monday
  41. if errorlevel 0 goto Sunday
  42.  
  43. :Sunday
  44. echo Today is Sunday!
  45. goto end
  46.  
  47. :Monday
  48. echo Today is Monday!
  49. goto end
  50.  
  51. :Tuesday
  52. echo Today is Tuesday!
  53. goto end
  54.  
  55. :Wednesday
  56. echo Today is Wednesday!
  57. goto end
  58.  
  59. :Thursday
  60. echo Today is Thursday!
  61. goto end
  62.  
  63. :Friday
  64. echo Today is Friday!
  65. goto end
  66.  
  67. :Saturday
  68. echo Today is Saturday!
  69. goto end
  70.  
  71. :end
  72. REM ****************
  73. REM END BATCH FILE
  74. REM ****************
  75.  
  76.         Note that the initial processing of the errorlevel was done
  77.         backwards and that goto end was in each little subroutine.
  78.  
  79.         This program could have a large variety of different uses.  Why
  80.         don't you drop us a line and let us know how YOU'RE using it?
  81.  
  82.         If you're still stymied, here's the actual AUTOEXEC.BAT from my
  83.         C:\.  This is a real-life batch file:
  84.  
  85. REM ********************************
  86. REM Here is the real-life batch file
  87. REM ********************************
  88. @echo off
  89. \utils\whatday
  90. if errorlevel == 6 C:\DOS\chkdsk f:
  91. if errorlevel == 5 C:\DOS\chkdsk c:
  92. if errorlevel == 4 C:\DOS\chkdsk d:
  93. if errorlevel == 3 C:\DOS\chkdsk c:
  94. if errorlevel == 2 C:\DOS\chkdsk d:
  95. if errorlevel == 1 C:\DOS\chkdsk c:
  96. if errorlevel == 0 C:\DOS\chkdsk d:
  97.  
  98. goto %config%
  99.  
  100. :Scrn
  101. c:\utils\saveit
  102. alias /R c:\dos\alist
  103. SET NU=C:\NORTON
  104. prompt $e[0;32m$P$G$e[1;34mBlat.$e[0;32m$g$e[0m
  105. PATH F:\TC\BIN;C:\BELFRY;C:\NORTON;C:\UTILS;C:\DOS;C:\;C:\WWIV
  106. goto end
  107.  
  108. :NDos
  109. alias /R c:\dos\alist
  110. SET NU=C:\NORTON
  111. prompt $e[0;32m$P$G$e[1;34mBlat.$e[0;32m$g$e[0m
  112. PATH F:\TC\BIN;C:\BELFRY;C:\NORTON;C:\UTILS;C:\DOS;C:\;C:\WWIV;
  113. goto end
  114.  
  115. :end
  116. REM ***************************
  117. REM End of real-life batch file
  118. REM ***************************
  119.  
  120.         What this batch file does is run CHKDSK on one of my drives each
  121.         day at boot-up.  A different drive is tested each day!  Again, I
  122.         hope you'll write to us and tell us how YOU have used WhatDay.
  123.  
  124.  
  125.         COPYRIGHT STUFF
  126.         ───────────────
  127.  
  128.         This program, while owned and copyrighted by Platypus
  129.         Programming, is hereby donated to the public domain at no cost
  130.         to you, the user.  The one requirement we have is that if you
  131.         distribute it, keep WHATDAY.COM, WHATDAY.DOC, and FILE_ID.DIZ
  132.         together either on a diskette or in an archive file called
  133.         WHTDAY11.ZIP.
  134.  
  135.         We have several other shareware and freeware programs we hope
  136.         you'll check out.  For a diskette with all our stuff, send $2
  137.         to:
  138.  
  139.                         Platypus Programming
  140.                         P.O. Box 6095
  141.                         Terre Haute, IN  47804-2318
  142.  
  143.         Send all comments to that address, as well, or call Insomnia BBS
  144.         at 812-466-4222, the official home of Platypus Programming.  We
  145.         can also be reached at the following network addresses:
  146.  
  147.              1@18262 WWIVLink    1@8265 WWIVNet    1@2001 ASSnet
  148.                        michael.lerch@hal9k.com internet
  149.  
  150.  
  151.         HISTORY OF WHATDAY
  152.         ──────────────────
  153.  
  154.         V.1.0 - Released 6/28/93.  Written in .C
  155.  
  156.         v.1.1 - Released 10/9/93.  Written in .ASM.  MUCH smaller while
  157.                 doing more!  Now in addition to returning the day of the
  158.                 week as an ERRORLEVEL it will say what day it is right
  159.                 on the screen.  A couple people mailed me saying they
  160.                 freaked out a little bit when they'd run the program,
  161.                 see a banner, but nothing would happen!
  162.